package com.chhlz.module.base.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.chhlz.module.base.model.ConsumptionPattern;
import com.chhlz.module.service.ConsumptionPatternService;
import com.opensymphony.xwork2.ModelDriven;

@Controller
@Action(value = "pattern", results = { @Result(name = "pattern", location = "/pattern.html") })
public class ConsumptionPatternAction extends BasicDataAction<ConsumptionPattern> 
implements ModelDriven<ConsumptionPattern>{

	/**
	 * 
	 */
	private static final long serialVersionUID = -7912279367411781117L;
	
	@Autowired
	private ConsumptionPatternService patternService;
	
	private ConsumptionPattern pattern = new ConsumptionPattern();

	@Override
	public ConsumptionPattern getModel() {
		return this.pattern;
	}
	
	public void grid(){
		super.grid(patternService);
	}
	
	public void add(){
		super.add(patternService, pattern);
	}
	
	public void edit(){
		super.edit(patternService, pattern);
	}
	
	public void remove(){
		super.remove(patternService, pattern.getCpId());
	}

}
